import React from 'react';
import css from './index.module.scss'
import { connect } from 'react-redux';
//withRouter让组件路由相关对象的函数
import {withRouter} from 'react-router-dom'
class SearchInput extends React.Component {
    render() { 
        // console.log(this.props);  
        return (
            <div className={css.search}>
                <div className={css.search_left}>
                   <div className={css.search_left_city} onClick={()=>this.props.history.push('/cityselect')}>
        <span>{this.props.cityName}</span>
                   <i className={`iconfont icon-arrow ${css.iconfont}`}></i>
                   </div>
                   <div className={css.search_left_input}>
                   <i className='iconfont icon-seach'></i>
                       <span>请输入小区或者地址</span>
                   </div>
                </div>
                <div className={css.search_map} onClick={()=>this.props.history.push('/MapFound')}>
                    <i className={`iconfont icon-map ${css.iconfont}`}></i>
                </div>
            </div>
        );
    }
}
 const mapStateToProps=(state)=>({
     cityName:state.address.city
 })
export default connect(mapStateToProps)(withRouter(SearchInput));